from wxpita import *

movies = [
    ('A West Lake Moment', 'Zi Yang', 'Mandarin', 'Romance'),
    ('Flash Point', 'Wilson Yip', 'Cantonese', 'Action'),
    ('Sympathy for Lady Vengeance', 'Chan-wook Park', 'Korean', 'Thriller'),
    ('Fighter in the Wind', 'Yun-ho Yang', 'Japanese', 'Action'),
]

f = SizedFrame [
    Grid(name='grid', expand=True, proportion=1),

    TextCtrl(name='log', style='te_multiline', expand=True, proportion=1)
]

@f.Init
def _():
    g = f.grid    
    g.CreateGrid(0, 4)
    for i, name in enumerate(['Title', 'Director', 'Language', 'Genre']):
        g.SetColLabelValue(i, name)

    g.SetColSize(0, 200)
    g.SetColSize(1, 150)

    g.AppendRows(len(movies))
    
    for i, row in enumerate(movies):
        for j in range(4):
            g.SetCellValue(i, j, row[j])

f.Show('Grid Example', size=(600,300))
